package vistas.abstractModels;

import java.util.List;

import javax.swing.table.AbstractTableModel;

import entidades.Entrenador;

public class EntrenadorTableModel extends AbstractTableModel {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String[] columnNames = { "Cédula", "Nombre", "Apellido",
			"F.Nacimiento", "F.Ingreso", "Dan", "Direccion", "Teléfono A",
			"Teléfono B", "T. Sangre" };
	private Object[][] data;
	private int numberOfRows;

	public EntrenadorTableModel(List<Entrenador> rows) {
		data = new Object[rows.size()][columnNames.length];
		numberOfRows = rows.size();

		for (int i = 0; i < rows.size(); i++) {
			data[i][0] = String.valueOf(rows.get(i).getId());
			data[i][1] = rows.get(i).getNombres();
			data[i][2] = rows.get(i).getApellidos();
			data[i][3] = rows.get(i).getFechaNacimiento();
			data[i][4] = rows.get(i).getFechaInscripcion();
			data[i][5] = rows.get(i).getDan();
			data[i][6] = rows.get(i).getDireccion();
			data[i][7] = rows.get(i).getTelefonoA();
			data[i][8] = rows.get(i).getTelefonoB();
			data[i][9] = rows.get(i).getTipoSangre();

		}
	}

	@Override
	public int getRowCount() {
		return numberOfRows;
	}

	@Override
	public int getColumnCount() {
		return columnNames.length;
	}

	@Override
	public Object getValueAt(int rowIndex, int columnIndex) {
		return data[rowIndex][columnIndex];
	}

	public String getColumnName(int index) {
		return columnNames[index];

	}

}
